Skip to content

fix(server): interrupt turns after approval cancellation - #5429

Open
t3-code[bot] wants to merge 2 commits into
mainfrom
t3bot/fix-approval-cancel-interrupt
Open

fix(server): interrupt turns after approval cancellation#5429
t3-code[bot] wants to merge 2 commits into
mainfrom
t3bot/fix-approval-cancel-interrupt

Conversation

@t3-code

@t3-code t3-code Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

what changed

  • interrupt the active provider turn after a successful approval cancel response
  • keep decline scoped to the current request
  • avoid interrupting when the provider response fails

why

Cancelling an approval only answered the request, so Cursor could continue the same turn and immediately ask for more approvals.

ui changes

None.

checks

  • 47 focused ProviderCommandReactor tests
  • server typecheck
  • targeted format and lint
  • git diff --check

Model: OpenAI (API model not exposed). Harness: T3bot.

Note

Interrupt provider turn after approval cancellation in ProviderCommandReactor

  • On thread.approval.respond events, the reactor now calls providerService.interruptTurn only when the decision is cancel and the approval response succeeds; declines are forwarded without interrupting.
  • If respondToRequest fails, a provider.approval.respond.failed activity is recorded and the interrupt is skipped.
  • If the interrupt itself fails, a provider.turn.interrupt.failed activity is recorded with the active turn ID and error detail.
  • Behavioral Change: approval cancellations now trigger a turn interrupt as a second step, whereas previously they did not.

Macroscope summarized 5c752ea.


Note

Medium Risk
Changes approval-handling orchestration and turn interruption timing in the provider reactor, which affects live agent sessions but is narrowly scoped and covered by new tests.

Overview
Fixes a case where cancelling an approval only told the provider the request was cancelled, so the same turn could keep running and prompt for more approvals.

ProviderCommandReactor now calls interruptTurn only when the approval decision is cancel and respondToRequest succeeds. decline still only forwards the response (no interrupt). If the approval response fails, the turn is not interrupted. A failed interrupt after a successful cancel is recorded as a provider.turn.interrupt.failed activity.

New ProviderCommandReactor tests cover decline-without-interrupt, cancel ordering (respond then interrupt), skipped interrupt on failed cancel response, and failed interrupt logging.

Reviewed by Cursor Bugbot for commit 5c752ea. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Aug 5, 2026
Comment thread apps/server/src/orchestration/Layers/ProviderCommandReactor.ts
@github-actions github-actions Bot added size:S 10-29 changed lines (additions + deletions). and removed size:XS 0-9 changed lines (additions + deletions). labels Aug 5, 2026
@t3-code
t3-code Bot marked this pull request as ready for review August 6, 2026 05:07
@macroscopeapp

macroscopeapp Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved 5c752ea

Straightforward bug fix that adds interrupt handling after approval cancellation. The change is limited in scope, includes proper error handling, and has comprehensive test coverage for all edge cases.

You can customize Macroscope's approvability policy. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants